nonlin_error_handling.f90 Source File


Source Code

! MIT License
!
! Copyright (c) 2017-2026 Jason Christopherson
!
! Permission is hereby granted, free of charge, to any person obtaining a copy
! of this software and associated documentation files (the "Software"), to deal
! in the Software without restriction, including without limitation the rights
! to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
! copies of the Software, and to permit persons to whom the Software is
! furnished to do so, subject to the following conditions:
!
! The above copyright notice and this permission notice shall be included in all
! copies or substantial portions of the Software.
!
! THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
! IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
! FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
! AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
! LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
! OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
! SOFTWARE.
!
module nonlin_error_handling
    use iso_fortran_env
    use linalg_errors, only : LA_OUT_OF_MEMORY_ERROR, LA_CONVERGENCE_ERROR, &
        LA_INVALID_OPERATION_ERROR
    implicit none

! ******************************************************************************
! ERROR FLAGS
! ------------------------------------------------------------------------------
    integer, parameter :: NL_NO_ERROR = 0
        !! A flag denoting no error.
    integer, parameter :: NL_INVALID_INPUT_ERROR = 201
        !! An error flag denoting an invalid input.
    integer, parameter :: NL_ARRAY_SIZE_ERROR = 202
        !! An error flag denoting an improperly sized array.
    integer, parameter :: NL_OUT_OF_MEMORY_ERROR = LA_OUT_OF_MEMORY_ERROR
        !! An error denoting that there is insufficient memory available.
    integer, parameter :: NL_INVALID_OPERATION_ERROR = &
        LA_INVALID_OPERATION_ERROR
        !! An error resulting from an invalid operation.
    integer, parameter :: NL_CONVERGENCE_ERROR = LA_CONVERGENCE_ERROR
        !! An error resulting from a lack of convergence.
    integer, parameter :: NL_DIVERGENT_BEHAVIOR_ERROR = 206
        !! An error resulting from a divergent condition.
    integer, parameter :: NL_SPURIOUS_CONVERGENCE_ERROR = 207
        !! An error indicating a possible spurious convergence condition.
    integer, parameter :: NL_TOLERANCE_TOO_SMALL_ERROR = 208
        !! An error indicating the user-requested tolerance is too small to be
        !! practical for the problem at hand.
    integer, parameter :: NL_INDEX_OUT_OF_RANGE_ERROR = 209
        !! An error flag denoting an array index is out of range.
    integer, parameter :: NL_DIVIDE_BY_ZERO_ERROR = 210
        !! An error flag denoting a division by zero error.
    integer, parameter :: NL_UNDEFINED_FUNCTION_ERROR = 211
        !! An error flag denoting that the routine containing the function to
        !! solve has not been properly defined.
    integer, parameter :: NL_UNDERDEFINED_PROBLEM_ERROR = 212
        !! An error flag denoting an underdefined problem error.

end module